import { OrderStatus, UserRole, OrderType, UrgencyLevel, RatingLevel } from '../common/enums';

/**
 * 用户模型
 */
export interface UserModel {
  id: string;
  name: string;
  phone: string;
  email?: string;
  role: UserRole;
  avatar?: string;
  createdAt: Date;
  updatedAt: Date;
}

/**
 * 工单模型
 */
export interface OrderModel {
  id: string;
  title: string;
  description: string;
  type: OrderType;
  status: OrderStatus;
  urgency: UrgencyLevel;
  
  // 用户信息
  userId: string;
  userName: string;
  userPhone: string;
  userAddress: string;
  
  // 维修人员信息
  maintainerId?: string;
  maintainerName?: string;
  maintainerPhone?: string;
  
  // 管理员信息
  adminId?: string;
  adminName?: string;
  
  // 时间信息
  createdAt: Date;
  updatedAt: Date;
  assignedAt?: Date;
  startedAt?: Date;
  completedAt?: Date;
  
  // 服务信息
  serviceFee?: number;
  serviceDescription?: string;
  
  // 评价信息
  rating?: number; // 1-5的数字评分
  feedback?: string;
  
  // 附件信息
  images?: string[];
  documents?: string[];
  
  // 备注信息
  notes?: string;
  adminNotes?: string;
}

/**
 * 创建工单请求模型
 */
export interface CreateOrderRequest {
  title: string;
  description: string;
  type: OrderType;
  urgency: UrgencyLevel;
  userAddress: string;
  images?: string[];
  documents?: string[];
}

/**
 * 更新工单状态请求模型
 */
export interface UpdateOrderStatusRequest {
  orderId: string;
  status: OrderStatus;
  notes?: string;
  serviceFee?: number;
  serviceDescription?: string;
}

/**
 * 派单请求模型
 */
export interface AssignOrderRequest {
  orderId: string;
  maintainerId: string;
  notes?: string;
}

/**
 * 评价请求模型
 */
export interface EvaluateOrderRequest {
  orderId: string;
  rating: number; // 1-5的数字评分
  feedback?: string;
}

/**
 * 工单查询参数
 */
export interface OrderQueryParams {
  userId?: string;
  maintainerId?: string;
  status?: OrderStatus;
  type?: OrderType;
  urgency?: UrgencyLevel;
  startDate?: Date;
  endDate?: Date;
  keyword?: string;
  page?: number;
  pageSize?: number;
}

/**
 * 分页响应模型
 */
export interface PagedResponse<T> {
  data: T[];
  total: number;
  page: number;
  pageSize: number;
  totalPages: number;
}

/**
 * API 响应模型
 */
export interface ApiResponse<T> {
  success: boolean;
  data: T;
  message: string;
  code: number;
}

/**
 * 统计数据模型
 */
export interface StatisticsModel {
  totalOrders: number;
  pendingOrders: number;
  processingOrders: number;
  completedOrders: number;
  canceledOrders: number;
  todayOrders: number;
  averageRating: number;
  completionRate: number;
}